import pygame
from init_map import InitMap


class Map(InitMap):
    def __init__(self, *args):
        InitMap.__init__(self)

        self.door_blue = pygame.image.load("../资源/图片/蓝门.png").convert_alpha()
        self.door_iron = pygame.image.load("../资源/图片/铁门.png").convert_alpha()
        self.little_feather = pygame.image.load("../资源/图片/小飞羽.png").convert_alpha()
        self.hp_blue = pygame.image.load("../资源/图片/蓝药.jpg").convert_alpha()
        self.ling_warrior = pygame.image.load("../资源/图片/灵武士.png").convert_alpha()
        self.ling_master = pygame.image.load("../资源/图片/灵法师.png").convert_alpha()
        self.dark_prince = pygame.image.load("../资源/图片/冥灵魔王.png").convert_alpha()
        self.octopus1 = pygame.image.load("../资源/图片/章鱼1.png").convert_alpha()
        self.octopus2 = pygame.image.load("../资源/图片/章鱼2.png").convert_alpha()
        self.octopus3 = pygame.image.load("../资源/图片/章鱼3.png").convert_alpha()
        self.octopus4 = pygame.image.load("../资源/图片/章鱼4.png").convert_alpha()
        self.octopus5 = pygame.image.load("../资源/图片/章鱼5.png").convert_alpha()
        self.octopus6 = pygame.image.load("../资源/图片/章鱼6.png").convert_alpha()
        self.octopus7 = pygame.image.load("../资源/图片/章鱼7.png").convert_alpha()
        self.octopus8 = pygame.image.load("../资源/图片/章鱼8.png").convert_alpha()
        self.octopus9 = pygame.image.load("../资源/图片/章鱼9.png").convert_alpha()

        self.hero_pos = (5, 10)
        self.variable_pos = {
            (3, 7): (self.little_feather, '小飞羽'),
            (7, 7): (self.little_feather, '小飞羽'),
            (1, 5): (self.hp_blue, '蓝药'),
            (2, 5): (self.hp_blue, '蓝药'),
            (3, 5): (self.hp_blue, '蓝药'),
            (4, 5): (self.hp_blue, '蓝药'),
            (6, 5): (self.hp_blue, '蓝药'),
            (7, 5): (self.hp_blue, '蓝药'),
            (8, 5): (self.hp_blue, '蓝药'),
            (9, 5): (self.hp_blue, '蓝药'),
            (4, 9): (self.hp_blue, '蓝药'),
            (6, 9): (self.hp_blue, '蓝药'),
            (3, 0): (self.door_iron, '墙'),
            (4, 0): (self.door_iron, '墙'),
            (5, 0): (self.door_iron, '墙'),
            (6, 0): (self.door_iron, '墙'),
            (7, 0): (self.door_iron, '墙'),
            (3, 1): (self.door_iron, '墙'),
            (7, 1): (self.door_iron, '墙'),
            (3, 2): (self.door_iron, '墙'),
            (7, 2): (self.door_iron, '墙'),
            (3, 3): (self.door_iron, '墙'),
            (7, 3): (self.door_iron, '墙'),
            (3, 4): (self.door_iron, '墙'),
            (7, 4): (self.door_iron, '墙'),
            (4, 4): (self.door_iron, '墙'),
            (6, 4): (self.door_iron, '墙'),
            (5, 6): (self.ling_warrior, '灵武士_sss'),
            (4, 7): (self.ling_warrior, '灵武士_sss'),
            (6, 7): (self.ling_warrior, '灵武士_sss'),
            (5, 8): (self.ling_warrior, '灵武士_sss'),
            (5, 5): (self.ling_master, '灵法师_sss'),
            (5, 9): (self.ling_master, '灵法师_sss'),
            (5, 7): (self.dark_prince, '冥灵魔王_sss'),
            (4, 1): (self.octopus1, '墙'),
            (5, 1): (self.octopus2, '墙'),
            (6, 1): (self.octopus3, '墙'),
            (4, 2): (self.octopus4, '墙'),
            (5, 2): (self.octopus5, '墙'),
            (6, 2): (self.octopus6, '墙'),
            (4, 3): (self.octopus7, '墙'),
            (5, 3): (self.octopus8, '血影'),
            (6, 3): (self.octopus9, '墙'),
        }

    def fixed_brick(self):
        for j in range(11):
            for i in [0, 1, 2, 8, 9, 10]:
                if (i, j) not in [(1, 5), (2, 5), (8, 5), (9, 5)]:
                    self.draw(self.wall, i, j)
                    self.dic[(i, j)] = '墙'
        for i in [(3, 6), (4, 6), (3, 8), (4, 8), (3, 9), (3, 10), (4, 10), (7, 6), (6, 6), (7, 8), (6, 8), (7, 9), (7, 10), (6, 10)]:
            self.draw(self.wall, i[0], i[1])
            self.dic[(i[0], i[1])] = '墙'
        for i in self.ls:
            self.screen.blit(self.road, i)
            self.dic[(int((i[0]-375)/48), int((i[1]-25)/48))] = '路'
